//很多组件都需要获取仓库里的主题变量，这里mixin就可以直接被引入
import { mapState } from "vuex";

export const themeMixins = {
  computed: {
    ...mapState({
      layoutMode: (state) => state.theme.layout,
      navTheme: (state) => state.theme.theme,
      primaryColor: (state) => state.theme.color,
      colorWeak: (state) => state.theme.weak,
      multipage: (state) => state.theme.multipage, //多页签设置
      fixedHeader: (state) => state.theme.fixedHeader,
      fixSiderbar: (state) => state.theme.fixSiderbar,
      contentWidth: (state) => state.theme.contentWidth,
      autoHideHeader: (state) => state.theme.autoHideHeader,
      sidebarOpened: (state) => state.theme.sidebar.opened,
      device: (state) => state.theme.device,
    }),
  },
  methods: {
    isMobile () {
      return this.device === 'mobile'
    },
    isDesktop () {
      return this.device === 'desktop'
    }
  }
};
